package com.lpf.hotelsystem.controller;

import com.lpf.hotelsystem.pojo.RoomsDisplayPicture;
import com.lpf.hotelsystem.service.impl.RoomsDisplayPictureServiceImpl;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import io.swagger.annotations.Api;

import javax.annotation.Resource;

/**
 * 客房展示图片实体表(RoomsDisplayPicture)表控制层
 *
 * @author makejava
 * @since 2025-01-18 19:33:28
 */
@RestController
@RequestMapping("roomsDisplayPicture")
@Api(value = "客房展示图片实体表(RoomsDisplayPicture)",tags = "客房展示图片实体表(RoomsDisplayPicture)接口API")
public class RoomsDisplayPictureController {
    /**
     * 服务对象
     */
    @Resource
    private RoomsDisplayPictureServiceImpl roomsDisplayPictureServiceImpl;

    /**
     * 一次性全部查询
     *
     * @return 查询结果
     */
    @GetMapping("/selectAll")
    public Map<String, Object> selectAll() {
        return roomsDisplayPictureServiceImpl.selectAll();
    }

    /**
     * 分页查询
     *
     * @param roomsDisplayPicture 筛选条件
     * @param page        要查询第几页
     * @param limit       每页显示多少条
     * @return 查询结果
     */
    @GetMapping("/selectByLimit")
    public Map<String, Object> selectByLimit(RoomsDisplayPicture roomsDisplayPicture, @RequestParam int page, @RequestParam int limit) {
        return roomsDisplayPictureServiceImpl.selectByLimit(roomsDisplayPicture, page, limit);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/selectById")
    public Map<String, Object> selectById(@RequestParam Integer id) {
        return roomsDisplayPictureServiceImpl.selectById(id);
    }

    /**
     * 新增数据
     *
     * @param roomsDisplayPicture 实体
     * @return 新增结果
     */
    @PostMapping("/insert")
    public Map<String, Object> insert(@RequestBody RoomsDisplayPicture roomsDisplayPicture) {
        return roomsDisplayPictureServiceImpl.insert(roomsDisplayPicture);
    }

    /**
     * 编辑数据
     *
     * @param roomsDisplayPicture 实体
     * @return 编辑结果
     */
    @PutMapping("/updateById")
    public Map<String, Object> updateById(@RequestBody RoomsDisplayPicture roomsDisplayPicture) {
        return roomsDisplayPictureServiceImpl.updateById(roomsDisplayPicture);
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping("/deleteById")
    public Map<String, Object> deleteById(@RequestParam Integer roomPhotoId) {
        return roomsDisplayPictureServiceImpl.deleteById(roomPhotoId);
    }

}

